﻿
Public Class fdproxy
    Inherits httpProxy2

    Private needFDHeaders As Boolean

    Public Overloads Sub initial(ByVal needFDHeaders As Boolean)
        Me.needFDHeaders = needFDHeaders
    End Sub

    Protected Overrides Function create() As Boolean
        If MyBase.create() Then
            If needFDHeaders Then
                FDRequest.insertheaders(context, request)
            End If
            Return True
        Else
            Return False
        End If
    End Function

    Protected Overrides Function enableGzip() As Boolean
        Return AppRespnose.gzipEnabled(response) AndAlso MyBase.enableGzip()
    End Function

    Protected Overrides Sub generateResponseHeaders()
        MyBase.generateResponseHeaders()
        AppRespnose.removeheaders(context)
        FDResponse.insertheaders(context)
    End Sub
End Class

Public Class fdproxyPool_t
    Inherits httpproxy2Pool_t

    Protected Overrides Function create() As httpproxy2
        Return New fdproxy()
    End Function

    Protected Overrides Sub tie(ByVal inst As httpproxy2)
        assert(Not inst Is Nothing)
        MyBase.tie(inst)
        convertor.cast(Of fdproxy)(inst).initial(holdtime)
    End Sub
End Class

Public Module _fdproxyPool
    Private _fdproxyPool As fdproxyPool_t = Nothing

    Public Function fdproxyPool() As fdproxyPool_t
        Return _fdproxyPool
    End Function

    Sub New()
        _fdproxyPool = New fdproxyPool_t()
    End Sub
End Module